-
Notifications
You must be signed in to change notification settings - Fork 220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking very nice! I've dropped a few comments inline asking about any
usage
@@ -797,7 +797,7 @@ describe('useBaseList', () => { | |||
</> | |||
))} | |||
|
|||
<button type="button" onClick={onNewDefault} /> | |||
<button type="button" onClick={onNewDefault as any} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to cast this as any seems odd. How come it's needed? Is there a way we can change the signature of onNewDefault
to make it compliant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose the brute force cast because the test doesn't deal with MouseEvents and I wanted to minimize changes to the original test. I followed the example of clickEvent() and changeEvent() used throughout react-forms tests. I agree it seems wonky, but I'm not sure how to avoid it without replacing Variant[]
values with fake React.MouseEvent
objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uuugh yeah, it seems that this is doing weird things - it's triggering a button onClick with an argument that is nothing to do with a MouseEvent I'm kinda surprised that this works at all. This shouldn't be using a button - is should be some custom Event type that gets triggered and then we can control the type rather than using something weird and not fit for purpose .
I guess this is fine for now - but at some point we should work out how to rework this to use a custom event rather than repurposing the onClick event
@@ -847,7 +847,7 @@ describe('useBaseList', () => { | |||
optionName: newDefaultOption, | |||
optionValue: newDefaultOptionValue, | |||
}, | |||
]); | |||
] as any); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to cast this as any seems odd. How come it's needed? Is there a way we can change the signature of newDefaultPrice/newDefaultOption/newDefaultOptionValue to make it compliant?
@@ -881,7 +881,7 @@ describe('useBaseList', () => { | |||
optionName: newDefaultOption, | |||
optionValue: newDefaultOptionValue, | |||
}, | |||
]); | |||
] as any); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to cast this as any seems odd. How come it's needed? Is there a way we can change the signature of newDefaultPrice/newDefaultOption/newDefaultOptionValue to make it compliant?
@@ -372,7 +374,7 @@ describe('useDynamicList', () => { | |||
</> | |||
))} | |||
|
|||
<button type="button" onClick={onNewDefault}> | |||
<button type="button" onClick={onNewDefault as any}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to cast this as any seems odd. How come it's needed? Is there a way we can change the signature of onNewDefault to make it compliant?
@@ -430,7 +432,7 @@ describe('useDynamicList', () => { | |||
optionName: newDefaultOption, | |||
optionValue: newDefaultOptionValue, | |||
}, | |||
]); | |||
] as any); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to cast this as any seems odd. How come it's needed? Is there a way we can change the signature of newDefaultPrice/newDefaultOption/newDefaultOptionValue to make it compliant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped a comment regarding the element test inline.
I'm happy to leave the react-form tests as is for now.
Description
Enable type-checking and fix type errors for a batch of packages.
Changes
cancelled
property.noop()
to match expected type.ReactPlugin
pluginmockField
to allow forField<undefined>
onClick
callbacks toany
in a test where the event is programmatically triggered.Root.find()
returns.randomVariants()
calldisable-next-line no-new
was suppressed for a test that withnew ApolloLink()
Root.find()
returnsnomodule
->noModule
createDefaultHistory
andcreateDefaultLocation
. NOTE: These functions aren't used within Quilt so it's not clear how to test the changes.src/tests/setup.ts
NodeJS.ReadableStream
aftercreateRender
is called.MockApp
to returnnull
instead ofvoid
in order to make it a valid JSX component.options: MountOptions
argument formountWithContext
being used ine2e.test.tsx
. NOTE: It's possibleoptions
SHOULD be an optional parameter. If that's the case,.createMount
typing should be changed instead.Node<unknown>
was being compared toElement<{}>
Type of change
Checklist